//package com.spring.showcase.init;
//
//import java.util.Arrays;
//import java.util.HashMap;
//import java.util.List;
//import java.util.Map;
//
//import org.springframework.context.annotation.Bean;
//import org.springframework.context.annotation.ComponentScan;
//import org.springframework.context.annotation.Configuration;
//import org.springframework.http.MediaType;
//import org.springframework.scheduling.annotation.EnableScheduling;
//import org.springframework.web.accept.ContentNegotiationManager;
//import org.springframework.web.accept.HeaderContentNegotiationStrategy;
//import org.springframework.web.accept.ParameterContentNegotiationStrategy;
//import org.springframework.web.servlet.View;
//import org.springframework.web.servlet.config.annotation.AsyncSupportConfigurer;
//import org.springframework.web.servlet.config.annotation.EnableWebMvc;
//import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
//import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
//import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;
//import org.springframework.web.servlet.view.ContentNegotiatingViewResolver;
//import org.springframework.web.servlet.view.UrlBasedViewResolver;
//import org.springframework.web.servlet.view.tiles3.TilesConfigurer;
//import org.springframework.web.servlet.view.tiles3.TilesView;
//
//import com.spring.showcase.interceptors.CallableInterceptor;
//import com.spring.showcase.interceptors.DeferredInterceptor;
//import com.spring.showcase.interceptors.RequestInterceptor;
//import com.spring.showcase.rss.AtomRss;
//
//@Configuration
//@EnableWebMvc
//@EnableScheduling
//@ComponentScan(basePackages = { "com.spring.showcase.**" })
//public class WebMvcConfig extends WebMvcConfigurerAdapter {
//
//	@Override
//	public void addResourceHandlers(ResourceHandlerRegistry registry) {
//		registry.addResourceHandler("/resources/**").addResourceLocations("/resources/");
//	}
//
//	@Override
//	public void configureAsyncSupport(AsyncSupportConfigurer configurer) {
//		configurer.registerDeferredResultInterceptors(new DeferredInterceptor());
//		configurer.registerCallableInterceptors(new CallableInterceptor());
//	}
//
//	@Override
//	public void addInterceptors(InterceptorRegistry registry) {
//		registry.addInterceptor(new RequestInterceptor());
//	}
//
//	@Bean
//	ContentNegotiatingViewResolver getContentNegotiatingViewResolver() {
//		ContentNegotiatingViewResolver contentNegotiatingViewResolver = new ContentNegotiatingViewResolver();
//		contentNegotiatingViewResolver.setContentNegotiationManager(getContentNegotiationManager());
//		contentNegotiatingViewResolver.setDefaultViews(getDefaultViewsForContentNeogitation());
//		return contentNegotiatingViewResolver;
//	}
//
//	@Bean
//	ContentNegotiationManager getContentNegotiationManager() {
//		return new ContentNegotiationManager(new ParameterContentNegotiationStrategy(getMediaTypeAssociations()), new HeaderContentNegotiationStrategy());
//	}
//
//	private List<View> getDefaultViewsForContentNeogitation() {
//		return Arrays.asList(getAtomRss());
//	}
//
//	private Map<String, MediaType> getMediaTypeAssociations() {
//		Map<String, MediaType> map = new HashMap<String, MediaType>();
//		map.put("atom", MediaType.APPLICATION_ATOM_XML);
//		return map;
//	}
//
//	@Bean
//	View getAtomRss() {
//		return new AtomRss();
//	}
//
//	@Bean
//	TilesConfigurer getTilesConfigurer() {
//		TilesConfigurer tilesConfigurer = new TilesConfigurer();
//		tilesConfigurer.setDefinitions(new String[] { "/WEB-INF/defs/general.xml" });
//		return tilesConfigurer;
//	}
//
//	@Bean
//	UrlBasedViewResolver getUrlBasedViewResolver() {
//		UrlBasedViewResolver urlBasedViewResolver = new UrlBasedViewResolver();
//		urlBasedViewResolver.setOrder(0);
//		urlBasedViewResolver.setViewClass(TilesView.class);
//		return urlBasedViewResolver;
//	}
//
//}
